package com.example.api.service;

import com.example.api.entity.UserEntity;
import com.example.base.BaseApiService;
import com.example.base.ResponseBase;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



/**
 * Create with Intellij idea
 * User:鲁智明
 * Date:2018/11/17
 * Time:17:43
 */
@RestController
public class MemberServiceImpl extends BaseApiService implements MemberService {

    @Value("${server.port}")
    private String serverPort;

    @RequestMapping("/getMember")
    public UserEntity getMember(@RequestParam("name")String name) {
        UserEntity userEntity=new UserEntity();
        userEntity.setName(name+",端口号:"+serverPort);
        userEntity.setAge(22);
        return userEntity;
    }


    @RequestMapping("/getUserInfo")
    public ResponseBase getUserInfo() {
        try {
            // 会员服务接口产生1.5秒延迟
            Thread.sleep(1500);

        }catch (Exception e){
            // 异常信息

        }
        return setResultSuccess("订单服务接口调用会员服务接口成功...");
    }
}
